<%@ include file="/common/taglibs.jsp"%>
<%@ page pageEncoding="UTF-8" contentType="text/html;charset=utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<!-- jquery -->
		<script src="${jquery}/jquery.js"></script>
		<script src="${jquery}/jquery.form.js"></script>
		<!-- colorbox -->
		<script type="text/javascript"
			src="${colorbox}/jquery.colorbox-min.js"></script>
		<link rel="stylesheet" type="text/css" href="${colorbox}/colorbox.css">
		<!-- easyui -->
		<script type="text/javascript" src="${easyui}/jquery.easyui.min.js"></script>
		<script type="text/javascript"
			src="${easyui}/locale/easyui-lang-zh_CN.js"></script>
		<link rel="stylesheet" type="text/css"
			href="${easyui}/themes/default/easyui.css">
		<!-- app -->
		<link rel="stylesheet" type="text/css" href="${app}/hnjz.css">
	</HEAD>

	<body>

		<form id="queryForm" method="post" action="loggerQuery.json">
			<input type="hidden" id="fid" name="fid" value="${fid}" />
			<input type="hidden" id="page" name="page" value="${page}" />
			<input type="hidden" id="pageSize" name="pageSize"
				value="${pageSize}" />
			<div class="divContainer">
				<table width="100%" border="0" align="center" cellpadding="0"
					cellspacing="0" class="formtable">
					<tr>
						<td>
							操作人：<input class="i-text" type="text" id="userName" name="userName"
								value="${userName}" title="操作人，回车可搜素" />
							操作类型：<input class="i-text" type="text" id="type" name="type"
								value="${type}" title="操作类型，回车可搜素" />
							操作对象：<input class="i-text" type="text" id="url" name="url"
								value="${url}" title="操作类型，回车可搜素" />
							操作时间：<input class="easyui-datetimebox" type="text" id="createtime" name="createtime"
								value="${createtime}"/>	
							<span class="btn btn-ok"> <input id="query" type="submit"
									value="搜索"> </span>
							<span class="btn btn-ok">
								<input id="clear" type="button" value="清空"/>
							</span>
						</td>
					</tr>
				</table>
			</div>
			<div class="divContainer" id="loggerlist">
				<table id="test" fit="true"></table>
			</div>
		</form>

		<p>
	</body>
</HTML>
<SCRIPT LANGUAGE="JavaScript">
$("#clear").click(function(){
	$("#userName").val("");
	$("#type").val("");
	$("#url").val("");
	$("#createtime").datetimebox('setValue','');
	ref();
});
function ref(){
	jQuery().colorbox.close();
	$('#queryForm').submit();
}
$('#query').click(function(){
	$('#page').val("1");
});
$('#queryForm').submit(function(){
      $("#queryForm").ajaxSubmit({
     	  success: function(data){
     	      $('#test').datagrid('loadData',data)
	          initPager();
	      }
	 });
     return false;  
});
function initPager(){
    var p = $('#test').datagrid('getPager');
	$(p).pagination({
				onSelectPage:function(pageNumber, pageSize){
				    $('#page').val(pageNumber);
				    $('#pageSize').val(pageSize);
					$(this).pagination('loading');
					$('#queryForm').submit();
					$(this).pagination('loaded');
				}
	});
}
$(document).ready(function(){
	$("#loggerlist").height($(window).height()-100);
	$('#test').datagrid({
				nowrap: false,
				striped: true,
				collapsible:true,
				singleSelect:true,
				url:'loggerQuery.json',
				onLoadSuccess:function(data){
      		    $(this).datagrid('doCellTip',{'max-width':'300px','delay':500});
                                    },
	            columns:[[
					{field:'userName',title:'操作人',sortable:true,width:100},
					{field:'type',title:'操作类型',width:100},
					{field:'url',title:'操作对象',width:100},
					{field:'createtime',title:'操作时间',align:'center',width:200},
					{field:'ipAddress',title:'IP地址',align:'center',width:100},
					{field:'macAddress',title:'Mac地址',hidden:'true',width:100},
				]],
				pagination:true,
				rownumbers:true
	});
    initPager()
});
</SCRIPT>